<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let target=Math.floor(Math.random()*100+1)
        console.log(target)
        function guessNumber(){
            let number=prompt("请输入你猜的数字")
            if(number===target)
            {
                alert("恭喜你回答正确")
            }
            else if(number<target){
                alert("小了")
                guessNumber()
            }
            else{
                alert("大了")
                guessNumber()
            }
        }
        guessNumber()
    </script>
</body>
</html>